package com.slz3.business.module.goodsManagement.gooBaseGoodsSpecification.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.goodsManagement.gooBaseGoodsSpecification.domain.GooBaseGoodsSpecification;
import com.slz3.business.module.goodsManagement.gooBaseGoodsSpecification.domain.GooBaseGoodsSpecificationFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class GooBaseGoodsSpecificationTransactionalServiceImpl implements GooBaseGoodsSpecificationTransactionalService {

    @Override
    public GooBaseGoodsSpecification modify(GooBaseGoodsSpecification gooBaseGoodsSpecificationNew) {
        Repositorys.gooBaseGoodsSpecification.test();
        Repositorys.gooBaseGoodsSpecification.save(GooBaseGoodsSpecificationFactory.initBaseFields());
        System.err.println(1/0);
        gooBaseGoodsSpecificationNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.gooBaseGoodsSpecification.saveAndFlush(gooBaseGoodsSpecificationNew);
    }

    @Override
    public List<GooBaseGoodsSpecification> batchModify(List<GooBaseGoodsSpecification> gooBaseGoodsSpecificationList) {
        return Repositorys.gooBaseGoodsSpecification.saveAll(gooBaseGoodsSpecificationList);
    }
}
